<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <form name="form1">
      <p>
        <input type="text" />
      </p>
    </form>
    <form name="form2">
      <p>
        <input type="text" />
      </p>
    </form>

    <script>
      // console.log(document.forms[0]);
      // console.log(document.forms[1]);
      // console.log(document.forms["form1"]);
      // console.log(document.forms["form2"]);

      console.log(document.form1);
      console.log(document.form2);

      // console.log(document.querySelector('[name="form1"]'));
      // console.log(document.querySelector('[name="form2"]'));
    </script>
  </body>
</html>
